package com.jame.concurrency.cas;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author : Jame
 * @date : 2021-07-10 16:53
 **/
public class A {

    private int i;

    public synchronized void addI() {
        i++;
    }

    public int getI() {
        return i;
    }

    private AtomicInteger atomicInteger=new AtomicInteger();

    public void addCAS(){
        atomicInteger.incrementAndGet();
    }

    public int getCAS(){
        return atomicInteger.getAndIncrement();
    }


}
